package util;

import java.util.ArrayList;
import java.util.List;

public class FieldUtil {

    public static List<Integer> getPositions(List<String> terms, String term) {
        List<String> temp = new ArrayList<String>();
        temp.addAll(terms);

        List<Integer> ret = new ArrayList<Integer>();
        for (int pos = ret.indexOf(term); pos >= 0; pos = ret.indexOf(term)) {
            temp.set(pos, "");
        }
        return ret;
    }

    public static String encode(List<String> list) {
        if (list.size() == 0) {
            return "";
        } else {
            StringBuilder sb = new StringBuilder();
            for (String s : list) {
                sb.append("\t");
                sb.append(s);
            }
            return sb.substring(1);
        }
    }

}
